/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package adsreis.com.Controls;

import adsreis.com.Beans.FormasBean;
import adsreis.com.Beans.StatusOrcamentoBean;
import adsreis.com.acessobd.AcessoMySql;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Pauroenriki
 */
public class StatusOrcamentoControl {
    
    PreparedStatement pstm;
    ResultSet rs;
    String consultaStatus = "SELECT * FROM STATUSORCAMENTO WHERE STATUSORCAMENTO LIKE ?";
    
    
    public StatusOrcamentoControl(){        
    }
    public List<StatusOrcamentoBean> listarStatus(String status){
        List<StatusOrcamentoBean> formas = new ArrayList();
        try{
            AcessoMySql mysql = new AcessoMySql();
           pstm = mysql.conectar().prepareStatement(consultaStatus);
           pstm.setString(1, status);
           rs = pstm.executeQuery();
           StatusOrcamentoBean fm;
           while (rs.next()){
               fm = new StatusOrcamentoBean();
               fm.setCodstatus(rs.getInt("codstatusorcamento"));
               fm.setStatus(rs.getString("statusorcamento"));               
               formas.add(fm);              
           }
           mysql.desconectar();
        }catch (Exception e){
            e.printStackTrace();
        }
        return formas;        
    }
    
    
}
